# -*- coding: utf-8 -*-
"""
Created on Mon Jul 11 14:06:16 2016

@author: Administrator
"""
dic=open('fingerDic.txt')
readdic=dic.readlines()
diclist=list(readdic)

text=open('testtxt.txt')
readtext=text.readlines()
textlist=list(readtext)

#max of diclist is 25


def cutword(line2):
    s2=''
    while line2 != 0:
        if len(line2)>25:
            strlen=26
            s1=line2[0:strlen]
            while len(s1)>0:
                s3=s1+'\n'
                if s3 in diclist:
                    s2=s2+s1+'/'
                    line2=line2[strlen:]
                    s1=''
                else:
                    strlen=strlen-1
                    s1=s1[0:strlen]
        else:
            strlen=len(line2)
            s1=line2
            while len(s1)>0:
                s3=s1+'\n'
                if s3 in diclist:
                    s2=s2+s1+'/'
                    line2=line2[strlen:]
                    s1=''
                else:
                    strlen=strlen-1
                    s1=s1[0:strlen]
    print(s2)


hua='而少量的粗分结果对后续过程的运行效率影响不会太大'
cutword(hua)